<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/address.css">	
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATES_PATH;?>/css/payPassword.css">	
<script type="text/javascript" src="<?php echo RESOURCE_PATH;?>/js/jquery.validation.min.js"></script>
<header class="layout head padding-small">
    <a href="javascript:pageBack();" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">修改支付密码</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<div class="margin bg-white padding radius-big">
<div class="mod-pay-pwd">
    <div class="step">
        <!--正在那一步的添加类active  已经通过了的添加类complete-->
        <div class="step-bar  <?php echo isset($output['step'])?'active':''?>" style="width:50%;"><span class="step-point  <?php echo isset($output['step'])?'icon-check':''?>"></span><span class="step-text">身份验证</span></span></div>
        <div class="step-bar <?php echo ($output['step'] == true)?'active':''?>" style="width:50%;"><span class="step-point <?php echo ($output['step'] == true)?'icon-check':''?>">2</span><span class="step-text">设置支付密码</span></div>
    </div>
</div>

<form id="password_form"  method="post" action="#">
<input type="hidden" name="form_submit" value="ok" />
<?php if($output['step'] == false){?>
<input type="hidden" name="mobile" id="mobile" value="<?php echo $_SESSION['member_mobile']?>" />
<input type="hidden" name="step" value="false" />
<?php }else{?>
<input type="hidden" name="step" value="true" />
<?php }?>
<div class="new-ct">
	<div class="new-addr">
        <div class="new-info-box" style="border: 0px;">
            <div class="new-set-info">
            	<?php if($output['step'] == false){?>
                <span class="new-txt2 new-mg-b5"><em style="color:#F00;">&lowast;</em>手机号码<?php echo  substr_replace($_SESSION['member_mobile'],'****',3,4);?></span>
                <span class="new-input-span new-mg-b5">
                    <span id="notify" style=" font-size:12px; color:#F00;display:none;">
						验证码已经以短信形式发到您的手机，30分钟内有效,请及时操作！
					</span>
				</span>
                <span class="new-txt2 new-mg-b5"><em style="color:#F00;">&lowast;</em>验证码<input type="button" id="getCode1" class="bg-red text-white padding margin-left radius-big border-none " value="获取短信验证码"></span>
                <span class="new-span-block new-mg-b5">
                    <span class="new-input-span">
                    	<input type="text" name="code" id="code"   placeholder="请输入短信验证码"  class="border border-ef7f7e layout padding radius-big " value="" autocomplete="off">
                    </span>
                </span>
                <?php }else{?>
                <span class="new-txt2 new-mg-b5"><em style="color:#F00;">&lowast;</em>新密码</span>
                <span class="new-span-block new-mg-b5">
                    <span class="new-input-span">
                    	<input type="password" name="new_password" id="new_password" maxlength="20" placeholder="请输入您的新支付密码"  class="border border-ef7f7e layout padding radius-big " value="" autocomplete="off">
                    </span>
                </span>
                <span class="new-txt2 new-mg-b5"><em style="color:#F00;">&lowast;</em>确认密码</span>
                <span class="new-span-block new-mg-b5">
                    <span class="new-input-span">
                    	<input type="password" name="confirm_password" id="confirm_password" maxlength="20" placeholder="请输入您的确认密码"  class="border border-ef7f7e layout padding radius-big " value="" autocomplete="off">
                    </span>
                </span>
                <?php }?>
            </div>
            <!--[D] 默认时加  new-abtn-default 把a标签换成span-->
            <a href="javascript:void();" name="order_submit" onclick="$('#password_form ').submit()" class="border-none bg-red text-white layout padding radius-big " style="text-align: center;"><?php echo ($output['step'] == false)?'下一步':'提交';?></a>
        </div>
	</div>
</div>
</form>

</div>
<script type="text/javascript">

<?php if($output['step'] == false){?>

$('#getCode1').click(function () {
	var mobile =$('#mobile').val();
	var outTime = 120;
	if(mobile =='') {alert('手机号不能为空');return false;}
	var ct= setInterval(CountDown, 1000);
	function CountDown() {
		$("#getCode1").attr("disabled", true);
		$("#getCode1").val(outTime + " 秒后重发");
		if (outTime == 0) {
			$("#getCode1").val("获取短信验证码").removeAttr("disabled");
			$('#notify').hide();
			clearInterval(ct);
		}
		outTime--;
	}
	$.getJSON('index.php?act=member_index&op=ajax_get_code_pay',{mobile:mobile},function (data){
		if(data.state==true){
			$('#notify').show();
		}else{
			alert('验证码发送失败');
		}
	});
})

$(function(){
    $('#password_form').validate({
		errorPlacement: function(error, element){
            var error_td = element.parent('span');
            error_td.find('label').hide();
            error_td.append(error);
        },
        rules : {
			code:{
				required: true,
			},
        },
        messages : {
			code:{
				required:'验证码不能为空',
			}
        }
    });

});
<?php }else{?>
$(function(){
    $('#password_form').validate({
		errorPlacement: function(error, element){
            var error_td = element.parent('span');
            error_td.find('label').hide();
            error_td.append(error);
        },
        rules : {
            new_password : {
                required   : true,
                minlength  : 6,
            },
            confirm_password : {
                required   : true,
                equalTo    : '#new_password'
            }

        },
        messages : {
            new_password  : {
                required   : '新密码不能为空',
                minlength  : '密码长度6~20位',
            },
            confirm_password : {
                required   : '确认密码不能为空',
                equalTo    : '新密码与确认密码不一致'
            }
        }
    });
});
<?php }?>
</script>

